package com.zy.rpc.common.constants;

/**
 * @author zy
 * @date 2023/5/2 19:21
 */

public enum MsgType {
    REQUEST((byte)0),

    RESPONSE((byte)1);

    public byte getType() {
        return type;
    }

    public void setType(byte type) {
        this.type = type;
    }

    private byte type;

    MsgType(byte type) {
        this.type=type;
    }

    public MsgType getTyoe(byte type){
        for (MsgType mt:MsgType.values()) {
            if(mt.getType()==type){
                return mt;
            }
        }
        return null;
    }
    public static MsgType fromByte(byte type) {
        for (MsgType mt : MsgType.values()) {
            if (mt.getType() == type) {
                return mt;
            }
        }
        return null;
    }

}
